package com.econ.powercloud.ems.common.enums;

/**
 * @Author : zjf
 * @Description : 电费确认单中数据的计算类型
 * @Date : 2022/4/24 10:23
 * @Modified by : zjf
 */
public enum FeeCalType implements EnumMethod{

    MIN_TIME_VAL(1,"最小时间对应的值"),
    MAX_TIME_VAL(2,"最大时间对应的值"),
    SUM_TIME_VAL(3,"所有时间对应的值求和"),
    FIRST_TIME_VAL(4,"第一个时间对应的值")
    ;

    private Integer code;
    private String desc;

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getDesc() {
        return desc;
    }

    FeeCalType(int code, String desc){
        this.code=code;
        this.desc=desc;
    }

    public static FeeCalType fromCode(int code){
        for(FeeCalType type: FeeCalType.values()){
            if(type.getCode() == code){
                return type;
            }
        }
        return null;
    }

}
